package com.zmn.plat.services.impl.channel.order.config;

import com.zmn.plat.model.entity.channel.order.config.ChannelOrderConfig;
import com.zmn.plat.model.entity.channel.order.config.ChannelOrderConfigQuery;
import com.zmn.plat.persistence.interfaces.channel.order.config.ChannelOrderConfigDao;
import com.zmn.plat.services.interfaces.channel.order.config.ChannelOrderConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 渠道订单配置表Service实现类
 *
 * @author linfeng
 *
 * @since 2020/10/30 11:45
 */
@Service
public class ChannelOrderConfigServiceImpl implements ChannelOrderConfigService {

    @Resource
    ChannelOrderConfigDao channelOrderConfigDao;

    @Override
    public ChannelOrderConfig findByKey(Integer channelId) {
        return channelOrderConfigDao.findByKey(channelId);
    }

    @Override
    public List<ChannelOrderConfig> listPageByQuery(ChannelOrderConfigQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return channelOrderConfigDao.listPageByQuery(query);
    }

    @Override
    public List<ChannelOrderConfig> listByQuery(ChannelOrderConfigQuery query) {
        return channelOrderConfigDao.listByQuery(query);
    }

    @Override
    public List<ChannelOrderConfig> listAll() {
        return channelOrderConfigDao.listAll();
    }

    @Override
    public Integer countByQuery(ChannelOrderConfigQuery query) {
        return channelOrderConfigDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ChannelOrderConfig channelOrderConfig) {
        return channelOrderConfigDao.updateByKey(channelOrderConfig);
    }

    @Override
    public Integer insert(ChannelOrderConfig channelOrderConfig) {
        return channelOrderConfigDao.insert(channelOrderConfig);
    }

    @Override
    public Integer deleteByKey(Integer channelId) {
        return channelOrderConfigDao.deleteByKey(channelId);
    }

    @Override
    public void copy(Integer originalChannelId, Integer targetChannelId, String operator) {

        channelOrderConfigDao.copy(originalChannelId, targetChannelId, operator);
    }
}